import { Pipe, PipeTransform } from "@angular/core";
import { Fun1 } from "../type/fun";

@Pipe({
  name: "filter",
  pure: false
})
export class FilterPipe implements PipeTransform {
  transform(list: any[], filterFun?: Fun1<boolean>): any {
    if (filterFun) {
      return list.filter(item => filterFun(item));
    }

    return list;
  }
}
